<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>filter</title>
</head>
<body>
<script>
    var arr1 = [1, 3, 6, 2, 5, 6];
    var arr2 = arr1.filter(function (item, index) {
        return item > 4; //将arr1中大于4的元素返回
    });
    console.log(arr2);
</script>
</body>
</html>